﻿#pragma once

#include <QString>

//Record===================================================================================================

//标志位
enum COLUMN_FLAGS
{
	CF_NONE = 0x0000,
	CF_SHOW = 0x0001,
	CF_EDIT = 0x0002,
	CF_PRIMARY = 0x0004,

	CF_COMBOBOX = 0x1000,					//编辑框类型COMBOBOX。
	CF_DATE = 0x2000,						//编辑时显示Date
	CF_SPINBOX = 0x4000,					//编辑时显示DOUBLESPINBOX
	CF_DOUBLESPINBOX = 0x8000,				//编辑时显示SPINBOX

	CF_EDIT_PRIMARY = 0x0006,
	CF_SHOW_EDIT = 0x0003,
	CF_SHOW_PRIMARY = 0x0005,
	CF_SHOW_EDIT_PRIMARY = 0x0007,

	CF_EDIT_COMBOBOX = 0x1003,				//编辑时显示Combox， 默认为Edit
	CF_EDIT_DATE = 0x2003,					//编辑时显示Date， 默认为Edit
	CF_EDIT_SPINBOX = 0x4003,				//编辑时显示SPINBOX， 默认为Edit
	CF_EDIT_DOUBLESPINBOX = 0x8003			//编辑时显示DoubleSPINBOX， 默认为Edit
};

enum COLUMN_TYPE
{
	CT_INT = 0,
	CT_DOUBLE,
	CT_STRING,
	CT_DATA
};

struct ColumnInfo
{
	int Length;
	COLUMN_TYPE Type;
	COLUMN_FLAGS Flag;
	QString Name;
	QString Alias;
};


//DataParse===================================================================================================
/* Json 数据交互格式
{
	Type: HeartBeat、Select、Update、Insert、Delete、Records
	Request：SQL、IP、UserName { Table Record } Reslut
	Response:
	Error:
}
*/

enum JsonDataType
{
	JDT_None = 0,
	JDT_HeartBeat,
	JDT_Select,
	JDT_Update,
	JDT_Insert,
	JDT_Delete,
	JDT_ExecSQL,
	JDT_Records,
	JDT_Result,
	JDT_END
};


//NetWork===================================================================================================
#define TCP_MAX_BUFFER_SIZE 1024000